package r6.pierwszy.raz;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.util.Date;

import javax.swing.JOptionPane;
import javax.swing.Timer;

public class PikuPiku implements Runnable {

	private class TimerListener implements ActionListener {

		@SuppressWarnings("unused")
		private PikuPiku outer;

		private TimerListener(PikuPiku outer){
			this.outer = outer;
		}
		
		@Override
		public void actionPerformed(ActionEvent e) {

			if (beep)
				System.out.println("pik-pik");
			System.out.println(DateFormat.getTimeInstance().format(new Date()));

		}

	}

	private boolean beep;
	private int interval;

	@Override
	public void run() {
		new Timer(interval, new TimerListener(this)).start();
		JOptionPane.showMessageDialog(null, "Koniec");
		System.exit(0);
	}
	
}
